***** run latent class logit (w/ 3 classes -- can change below)
clear all
set max_memory 8g
set more off
cd "H:\dissertation\Aim 1"
import delimited "H:\dissertation\Aim 1\ai_pcp_processed.csv"

set seed 98405

global randvars "sens_89 sens_94 spec_89 spec_94 rad_part rad_all evid_rct evid_both tran_part tran_full repr_med repr_high optout"
global casevars "practice_years tech_negative rad_contact_med_high urban midwest northeast south female"

lclogit choice $randvars, group(indid) id(id) nclasses(3) membership($casevars)
lclogitml

***** get ranges for reference categories
clear all
set max_memory 8g
set more off
cd "H:\dissertation\Aim 1"
import delimited "H:\dissertation\Aim 1\ai_pcp_processed2.csv"

set seed 98405

global randvars "sens_89 sens_85 spec_89 spec_85 rad_part rad_none evid_rct evid_obs tran_part tran_none repr_med repr_low optout"
global casevars "practice_years tech_negative rad_contact_med_high urban midwest northeast south female"

lclogit choice $randvars, group(indid) id(id) nclasses(3) membership($casevars)
lclogitml

***** random parameters logit (no case vars)
clear all
set max_memory 8g
set more off
cd "H:\dissertation\Aim 1"
import delimited "H:\dissertation\Aim 1\ai_pcp_processed.csv"

set seed 98405

global randvars "sens_89 sens_94 spec_89 spec_94 rad_part rad_all evid_rct evid_both tran_part tran_full repr_med repr_high optout"

mixlogit choice, rand($randvars) group(indid) id(id) nrep(50) ln(1) cluster(id)